//
//  VisitListCell2.m
//  YunGui
//
//  Created by wmm on 16/4/28.
//  Copyright © 2016年 hanen. All rights reserved.
//

#import "VisitListCell2.h"
#import "VisitModel.h"

#define LeftWidth [UIView getWidth:20.0f]
#define LabelHeight 20.0f

@implementation VisitListCell2

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        self.clipsToBounds = YES;
        
        //选中单元格
        //        UIView *bgView = [[UIView alloc] init];
        //        bgView.backgroundColor = [UIColor colorWithRed:(20.0f/255.0f) green:(30.0f/255.0f) blue:(40.0f/255.0f) alpha:0.5f];
        //        self.selectedBackgroundView = bgView;
        CGFloat lineW = 3.0f;
        
        UIView *leftLine1 = [[UIView alloc] initWithFrame:CGRectMake(LeftWidth, 0.0f, lineW, 10.0f)];
        leftLine1.backgroundColor = LEFTLINECOLOR;
        
        UIImageView *quanImg = [[UIImageView alloc] initWithFrame:CGRectMake(LeftWidth-6.0f, leftLine1.maxY+lineW,15.0f, 15.0f)];
        quanImg.image = [UIImage imageNamed:@"Btn_Normal_Shijianquan.png"];
        
        UIView *leftLine2 = [[UIView alloc] initWithFrame:CGRectMake(LeftWidth, quanImg.maxY+lineW, lineW, 95.0-quanImg.maxY-lineW)];
        leftLine2.backgroundColor = LEFTLINECOLOR;
        
        CGFloat W = [@"2015-05-13 19:02:25" boundingRectWithSize:CGSizeMake(MAXFLOAT, self.visitDate.height) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [ViewTool getFont:13.0f],NSForegroundColorAttributeName : GRAYCOLOR2} context:nil].size.width;
        
        CGRect visitNumFrame = CGRectMake(leftLine2.maxX+15.0f, leftLine1.maxY+2.0f, kScreenWidth-leftLine2.maxX-LabelHeight-W-10.0f, LabelHeight);
        self.visitNum = [[UILabel alloc] initWithFrame:visitNumFrame];
        self.visitNum.font = [ViewTool getFont:14.0f];
        self.visitNum.textColor = BLACKCOLOR;
        
        CGRect visitDateFrame = CGRectMake(kScreenWidth-W-20.0f, self.visitNum.y, W+5.0f, LabelHeight);
        self.visitDate = [[UILabel alloc] initWithFrame:visitDateFrame];
        self.visitDate.font = [ViewTool getFont:13.0f];
        self.visitDate.textColor = GRAYCOLOR2;
        
        self.last_at = [[UILabel alloc] initWithFrame:visitDateFrame];
        self.last_at.font = [ViewTool getFont:13.0f];
        self.last_at.textColor = GRAYCOLOR2;
        [self.contentView addSubview:self.last_at];
        
        //        self.visitDate.textAlignment=NSTextAlignmentRight;
        self.visitDate.text = @"2015-05-13 19:02:25";

        CGRect visitSubFrame = CGRectMake(self.visitNum.x, self.visitNum.maxY+5.0f, kScreenWidth-leftLine2.maxX-10.0f, LabelHeight);
        self.visitSub = [[UILabel alloc] initWithFrame:visitSubFrame];
        self.visitSub.font = [ViewTool getFont:15.0f];
        self.visitSub.textColor = BLACKCOLOR;
        
        CGRect visitProFrame = CGRectMake(self.visitNum.x,self.visitSub.maxY+5.0f, self.visitSub.width, LabelHeight);
        self.visitPro = [[UILabel alloc] initWithFrame:visitProFrame];
        self.visitPro.font = [ViewTool getFont:15.0f];
        self.visitPro.textColor = BLACKCOLOR;
        
        UIView *bottomLine = [ViewTool getLineViewWith:CGRectMake(visitNumFrame.origin.x, 95.0-1.0f, kScreenWidth-self.visitNum.x, 1.0f) withBackgroudColor:LEFTLINECOLOR];
        
        [self.contentView addSubview:leftLine1];
        [self.contentView addSubview:quanImg];
        [self.contentView addSubview:leftLine2];
        
        [self.contentView addSubview:self.visitNum];
        [self.contentView addSubview:self.visitSub];
        [self.contentView addSubview:self.visitPro];
        [self.contentView addSubview:self.visitDate];
        [self.contentView addSubview:bottomLine];
        
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end
